<template>
	<view class="content">
	<!-- 	<u-navbar leftIcon="" leftIconSize="0px" >
			<slot>
				<uni-icons type="back" size="24" color="black" @click="goBack"> </uni-icons>
				导师专家
			</slot>
		</u-navbar> -->
		
	
	      <image :src="config.topimg" class="swiperImg"  style="width: 100%;" mode="widthFix"/>
		<!-- 明星导师 -->
		<view class="popularCoursesBox" v-for="(item,index) in expertcatelist"  >
			<view class="ename" style="padding: 0px  18px;">{{item.ename}}</view>
			<view class="name"  style="padding: 0px  18px;">{{item.name}}</view>
			
			<!-- <image :src="item.nameimg" class="popularCoursesImg" /> -->
			<view style="padding: 0px  22px;">
				<view class="line"></view>
				<view class="container">
					<view class="square"   v-for="(item1, index1) in item.children" :key="index1"   @click="goexpert(item1.id)" :style="{'backgroundImage':'url('+item.bgimg +')'}">
				<!-- 		<view class="inner"   :style="{'backgroundImage':'url('+item.bgimg +')'}" >
						</view>
						 -->
						<image :src="item1.avatar"  class="square-avatar"  mode="widthFix"></image>
						<view class="pink-bar"> <text class="bar-text">{{item1.name}}</text>
						</view>
					</view>
				</view>
			</view>
		</view>

	</view>
</template>

<script>
	import {
		baseURL,
		basePath
	} from '@/config/app'
	export default {
		data() {
			return {
				banner: [],
				config:{},
				specialSwiper: {
					current: 0,
					mode: 'default',
					dotsStyles: {
						bottom: 10,
						border: '1px rgba(255, 255, 255, 1) solid',
						backgroundColor: 'grey',
						selectedBackgroundColor: '#f08329',
						selectedBorder: '1px rgba(255, 255, 255, 1) solid'
					},
					info: [],
				},
				squares: [{
						name: 1
					},
					{
						name: 1
					},
				],
				popularCourses: [],
				liveCourses: [],
				selectedCourses: [],
				expertcatelist: [], //公益讲座
				coursePackage: [] //课程套餐
			}
		},
		onShow() {
			// console.log(this.isLogin);
			// if (!this.isLogin) return this.$Router.push('/pages/login/login');
		},
		onLoad() {
			
			var that=this
			this.$request.get(`course/shortvideo/getExpertCategories`).then(res => {
				that.expertcatelist=res.data.data
				console.log(that.expertcatelist);
			})
			
			this.$request.get(`course/shortvideo/getConfig`).then(res => {
				that.config=res.data.data
				console.log(that.config);
			})
			
		},
		methods: {
			goBack() {
				uni.navigateBack({
					delta: 1
				});
			},
			getPage() {
				apiGetPage({
					type: 5,
					goods_id: this.goods_id
				}).then((data) => {
					const {
						common,
						content
					} = data
			
					this.pagesData = content
					uni.setNavigationBarTitle({
						title: common.title
					})
				})
			},
			goexpert(id){
				this.$navto.navto('/course/expert/expert', {
					id: id
				})
			},
			jump(type, id) {
				if (type == 1) { //商品
					this.$navto.navto('/pages/goods_detail/goods_detail', {
						id: id
					})
				}
				if (type == 2) { //课程
					this.$navto.navto('/course/info/info', {
						id: id
					})
				}
				if (type == 4) { //虚拟商品
					this.$navto.navto('/course/training_camp/training_camp', {
						id: id
					})
				}
			},
			// ...mapActions(['getUser']),
			change(e) { //改变轮播指示点
				this.specialSwiper.current = e.detail.current;
			},
		}
	}
</script>

<style lang="scss" scoped>
	.square-avatar{
		width: 100%; 
		position: absolute;
		bottom: 0px;
		border-bottom-left-radius: 10px;
		border-bottom-right-radius: 10px;
	}

	.ename{
	    font-size: 26px;
		font-weight: bold;
		// background-color: #d98847;
		border-left: 3px solid  #e1a06c;
		// border-left-color:;
	}
	.name{
		font-size: 16px;
		font-weight: bold;
		border-left: 3px solid  #e1a06c;
	}
	/* 容器样式 */
	/* 容器样式 */
	/* 容器样式 */
	
	.content{
		padding-bottom: 74px;
	}
	
	.container {
		margin-top: 20px;
		display: flex;
		flex-wrap: wrap;
		/* 自动换行 */
		justify-content: space-between;
	

		
		/* 水平居中 */
	}

	/* 外层正方形容器 */
	.square {
		width: calc(50% - 5px);
		/* 计算宽度：一半减去间距和边距 */
		position: relative;
		/* 上下左右的间距 */
		box-sizing: border-box;
		border-radius: 10px;
		/* 确保padding和border不会影响大小 */
		background-size: cover;
	}

	/* 使用padding-top实现正方形 */
	.square::before {
		content: '';
		display: block;
		padding-top: 100%;
		border-radius: 10px;
		/* 高度等于宽度 */
	}

	/* 内部正方形内容 */
	.inner {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100%;
		background-size: cover;
		border-radius: 10px;
		text-align: center;
		/* 绿色填充 */
	}

	/* 粉色长条样式 */
	.pink-bar {
		position: absolute;
		/* 绝对定位，基于父级正方形 */
		bottom: 0;
		/* 固定在底部 */
		left: 0;
		/* 左对齐 */
		width: 100%;
		/* 宽度和正方形一致 */
		height: 20%;
		/* 高度是正方形高度的20% */
		background-color: #ffeae9;
		/* 粉色，透明度为0.5 */
		display: flex;
		/* 使用flex布局 */
		align-items: center;
		/* 垂直居中 */
		justify-content: center;
		opacity: 0.9;
		border-bottom-left-radius: 10px;
		border-bottom-right-radius: 10px;
		/* 水平居中 */
	}

	/* 文字样式 */
	.bar-text {
		 color: rgb(44, 44, 44);

		/* 文字颜色为黑色 */
		font-size: 14px;
		/* 字体大小 */
		text-align: center;
		/* 文字居中 */
		white-space: nowrap;
		/* 防止文字换行 */
	}

	/* 每行两个正方形之间的水平间距 */
	.square:nth-child(2n + 1) {
		margin-right: 5px;
		/* 第一个正方形右侧增加10px间距 */
	}

	.square:nth-child(2n) {
		margin-left: 5px;
		/* 第二个正方形左侧增加10px间距 */
	}

	.line {
		height: 1rpx;
		background-color: #dcdcdc;
		margin-top: 40rpx;
	}


	.popularCoursesBox {
		position: relative;
		width: 100%;
		margin-top: 95rpx;
		
		.popularCoursesList {
			width: 676rpx;

			margin-top: 80rpx;

			.popularCoursesItem {
				position: relative;
				width: 676rpx;
				margin-bottom: 45rpx;
				height: 177rpx;

				.endBtn {
					position: absolute;
					width: 128rpx;
					height: 50rpx;
					border-radius: 25rpx;
					background-color: #c8c8c8;
					top: 127rpx;
					right: 37rpx;
					font-size: 22rpx;
					color: #fff;
					line-height: 50rpx;
					text-align: center;
				}

				.learnBtn {
					position: absolute;
					width: 128rpx;
					height: 50rpx;
					border-radius: 25rpx;
					background-color: #f08329;
					top: 127rpx;
					right: 0rpx;
					font-size: 22rpx;
					color: #fff;
					line-height: 50rpx;
					text-align: center;
				}

				.popularPrice {
					position: absolute;
					color: #f08329;
					top: 140rpx;
					left: 320rpx;
					font-size: 25rpx;
				}

				.popularNumBox {
					position: absolute;
					width: 100%;
					height: 24rpx;
					left: 320rpx;
					top: 60rpx;
					display: flex;
					align-items: flex-start;

					.arrowIcon {
						width: 22rpx;
						height: 24rpx;
						margin-top: 5rpx;
					}

					.peopleLabel {
						font-size: 19rpx;
						color: #8e8e8e;
						margin-left: 15rpx;
					}

					.line1 {
						width: 1rpx;
						height: 20rpx;
						margin-left: 30rpx;
						background-color: #dcdcdc;
						margin-top: 5rpx;
					}

					.timeIcon {
						width: 21rpx;
						height: 21rpx;
						margin-left: 30rpx;
						margin-top: 5rpx;
					}

					.popularTotal {
						font-size: 19rpx;
						color: #8e8e8e;
						margin-left: 15rpx;
					}
				}

				.popularTitle {
					position: absolute;
					font-size: 25rpx;
					color: #141414;
					top: 0;
					left: 320rpx;
					font-weight: 700;
					overflow: hidden;
					white-space: nowrap;
					text-overflow: ellipsis;
				}

				.popularType {
					position: absolute;
					width: 68rpx;
					height: 37rpx;
					left: 0;
					top: 0;
				}

				.popularCover {
					width: 271rpx;
					height: 177rpx;
					border-radius: 10rpx;
				}
			}
		}

		.more {
			position: absolute;
			font-size: 20rpx;
			color: #8e8e8e;
			right: 42rpx;
			top: 62rpx;
			font-family: 'ar';
		}

		.popularCoursesImg {
			width: 450rpx;
			height: 93rpx;
		}
	}

	.swiperBox {
		width: 750rpx;
		height: 463rpx;

		.swiper-item,
		.swiperImg {
			width: 100%;
			height: 100%;
		}
	}

	.content {
		position: fixed;
		width: 100%;
		height: 100%;
		overflow-y: scroll;
		overflow-x: hidden;
		background-color: #fff;

		/deep/.u-navbar-left {
			display: none !important;
		}

		.logo {
			width: 320rpx;
			height: 52rpx;
			margin-left: 40rpx;
		}
	}

	/deep/ page {
		width: 100%;
		height: 100%;
		overflow-y: scroll;
		background-color: #fff !important;
		padding-bottom: 0 !important;
	}
</style>